package com.systop.dxjj.modules.findteacher.controller;


import com.systop.dxjj.common.pojo.Findteacher;
import com.systop.dxjj.common.utils.R;
import com.systop.dxjj.modules.findteacher.service.FindteacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



/**
 * @author 吴健伟
 */
@RestController
@Api("教师管理模块")
public class FindteacherController {

    @Autowired
    private FindteacherService findteacherService;

    @GetMapping("/findTeachersInfo")
    @ApiOperation(value = "查询教师信息",notes = "教师信息")
    public R findTeachersInfo(){

        return findteacherService.selectAllTeacherInfo();
    }

    @PostMapping("/insertTeachersInfo")
    @ApiOperation(value = "增添教师信息",notes = "教师信息")
    private R insertTeacherInfo(@RequestBody Findteacher findteacher){
        return findteacherService.insertTeacherInfo(findteacher);
    }

    @PostMapping("/updateTeachersInfo")
    @ApiOperation(value = "修改教师信息",notes = "教师信息")
    private R updateTeacherInfo(@RequestBody Findteacher findteacher){
        return findteacherService.updateTeacherInfo(findteacher);
    }

    @GetMapping("/delTeachersInfo/{id}")
    @ApiOperation(value = "删除教师信息",notes = "教师信息")
    private R delTeacherInfo(@PathVariable Integer id){
        return findteacherService.delTeacherInfo(id);
    }

    @GetMapping("/findTeachersInfoByName/{name}")
    @ApiOperation(value = "根据老师姓名查询教师信息",notes = "教师信息")
    private R selectTeacherInfoByName(@PathVariable String name){
        return findteacherService.selectTeacherInfoByName(name);
    }

    @GetMapping("/findByPage/{pageNum}/{pageSize}")
    @ApiOperation(value = "分页",notes = "教师信息")
    public R findByPage(@PathVariable Integer pageNum, @PathVariable Integer pageSize) {
        return findteacherService.findByPage(pageNum,pageSize);
    }
}
